<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>雷兽互动官网-后台管理系统</title>
    <link rel="icon" href="../../img/favicon.ico" />
    <link rel="stylesheet" href="../../plugin/bootstrap/css/bootstrap.min.css">
    <style>
        .container {
            margin-top: 100px;
            margin-bottom: 200px;
        }
    </style>
</head>

<body>
    <div class="container">
        <div id="login_box">
            <h1>雷兽互动官网-后台管理系统</h1>
            <form style="width: 400px;">
                <div class="form-group">
                    <label for="userName">账号</label>
                    <input type="text" class="form-control" id="userName">
                </div>
                <div class="form-group">
                    <label for="passWord">密码</label>
                    <input type="password" class="form-control" id="passWord">
                </div>
                <button type="submit" class="btn btn-primary" id="submit">登入</button>
            </form>
        </div>
    </div>

</body>
<script src="../plugin/jquery/index.js" type="text/javascript"></script>
<script src="../plugin/popper/index.js" type="text/javascript"></script>
<script src="../plugin/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>

<script>
  
    $(function() {
        $("#submit").click(() => {
            let params = {
                userName: $("#userName").val(),
                passWord: $("#passWord").val(),
            }
            $.ajax({
                url: "/api/login",
                type: "post",
                data: params,
                success: res => {
                    if (res.code == 200 ) {
                       window.location.href = "./admin.html"
                    } else {
                        alert(res.msg)
                    }
                }
            })
            return false
        })
    })
</script>

</html>